package com.wuhao.springboot.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wuhao.springboot.entity.Role;
import com.wuhao.springboot.mapper.RoleMapper;
import com.wuhao.springboot.service.RoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description
 * @Date 2023/2/4 23:17
 * @Author pq
 */
@Service
public class RoleImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {

    @Resource
    private RoleMapper roleMapper;

    @Override
    public List<Role> roleList() {
        return roleMapper.selectList(null);
    }

    @Override
    public int addRole(String roleName) {
        Role role=new Role();
        role.setName(roleName);
        return roleMapper.insert(role);
    }

    @Override
    public void delete(String id) {
        roleMapper.deleteById(id);
    }
}
